package com.biyao.controller.product;


import com.baomidou.mybatisplus.plugins.Page;
import com.biyao.schedulingcommon.response.BaseMsg;
import com.biyao.schedulingcommon.response.SuccessMsg;
import com.biyao.schedulingentity.product.TProductionPlanIEntity;
import com.biyao.service.model.product.imp.TProductionPlanIService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



/**
 * 
 *
 * @author code generator
 * @date 2019-09-16 09:44:20
 */
@Api(tags = {"生产计划模版"})
@RestController
@RequestMapping("api/v1/tproductionplani")
public class TProductionPlanIController {

    @Autowired
    private TProductionPlanIService tProductionPlanIService;

    /**
    * 待完善
    * @param pageNum 待完善
    * @param pageSize 待完善
    * @return  待完善
    */
    /**
    *
    * @ApiOperation(value = "列表")
    * @GetMapping
    */
    public BaseMsg list(@RequestParam(defaultValue = "1") Integer pageNum,
                        @RequestParam(defaultValue = "10") Integer pageSize
    ) {
        Page page = tProductionPlanIService.list(pageNum, pageSize);

        return new SuccessMsg(page);
    }


    /**
    * 待完善
    * @return 待完善
    */
    /**
     *
     *@ApiOperation(value = "详情")
     *@GetMapping("/info/{id}")
     */
    public BaseMsg info(@PathVariable("id") Integer id) {
            TProductionPlanIEntity tProductionPlanI = tProductionPlanIService.selectById(id);

        return new SuccessMsg(tProductionPlanI);
    }

    /**
    * 待完善
    * @return 待完善
    */
    /**
    * @ApiOperation(value = "保存")
    * @PostMapping
    */
    public BaseMsg save(@RequestBody TProductionPlanIEntity tProductionPlanI) {
            tProductionPlanIService.insert(tProductionPlanI);
        return new SuccessMsg();
    }

    /**
    * 待完善
    * @return 待完善
    */
    /**
    *@ApiOperation(value = "更新")
    *@PutMapping
    */
    public BaseMsg update(@RequestBody TProductionPlanIEntity tProductionPlanI) {

        tProductionPlanIService.updateAllColumnById(tProductionPlanI);

        return new SuccessMsg();
    }


}
